/***********************************************************************
 * $Id : CAmiMain.cpp    2011/11/10 00:00:00
 *
 *       swhors@naver.com
 * hist : 2011/11/10 19:41 first work.
 ***********************************************************************/

#include <iostream>

//using namespace std;

#include <stdio.h>
#include <memory.h>
#include <unistd.h>

#include <sys/types.h>
#include <sys/socket.h>

#include "constant.h"

#include "SkyConf.h"
#include "Socket.h"
#include "AmiConnector.h"
#include "AcdListener.h"

#include "AmiManager.h"

CSkyConf      CAmiManager::mSkyConf;
CAmiConnector CAmiManager::mAmiConnector;
CAcdListener  CAmiManager::mAcdListener;
char          CAmiManager::mRecordPathName[MAX_PATH_LENGTH];
EPROCSTATE    CAmiManager::mRunProcess;
EDBCONSTATE   CAmiManager::mDbConnected;
EAMICONSTATE  CAmiManager::mAmiConnected;



CAmiManager::CAmiManager()
{
   mAmiConnected = e_con_false;
   mRunProcess = e_proc_ready;
   mDbConnected = e_db_con_false;
}

CAmiManager::~CAmiManager()
{
}

int CAmiManager::initialize()
{
   int sRet = 1;
   sRet = mAmiConnector.initialize();
   if ( sRet == 0 )
   {
      goto err_amimanager_init;
   }
   mAcdListener.initialize();

err_amimanager_init:
   
   return sRet;
}

void CAmiManager::finalize()
{
}

EPROCSTATE CAmiManager::IsRunProcess()
{
   return mRunProcess;
}

void CAmiManager::SetRunProcess( EPROCSTATE aVal )
{
   mRunProcess = aVal;
}

EDBCONSTATE CAmiManager::IsDbConnected()
{
   return mDbConnected;
}

void CAmiManager::SetDbConnected( EDBCONSTATE aVal )
{
   mDbConnected = aVal;
}

EAMICONSTATE CAmiManager::IsAmiConnected()
{
   return mAmiConnected;
}

void CAmiManager::SetAmiConnected( EAMICONSTATE aVal )
{
   mAmiConnected = aVal;
}

CSkyConf *CAmiManager::getConf()
{
   return &mSkyConf;
}
